// const mongoConnected = require("../lib/mongoose_connect");
// const mongoModels = require("../lib/mongoose_schemas");
const lodash = require("lodash");
const fs = require("fs-extra");
const path = require("path");
const THREE = require("three");
const DATA2 = require("../test/210223_inzone-gaoshou-2.json");
debugger




return
let MIN_GAP = 100 * 100;
let MIN_denominator = 1000;
let log = {
  quanti: [],
  gaoshou: [],
  dishou: []
};
let source_data = {
  quanti: DATA2.sort((a, b) => a.distance_to_airline - b.distance_to_airline),
  gaoshou: DATA2.filter(e => e.is_gaoshou).sort((a, b) => a.distance_to_airline - b.distance_to_airline),
  dishou: DATA2.filter(e => !e.is_gaoshou).sort((a, b) => a.distance_to_airline - b.distance_to_airline),
};
['gaoshou', 'quanti', 'dishou'].forEach(str => {
  let source = source_data[str];
  for (let i = 0; i < source.length;) {
    let min = i;
    let max = i + MIN_denominator;
    if (max >= source.length) {
      max = source.length;
    }
    let sliced = source.slice(min, max);
    let qianwu = sliced.filter(e => e.ranking <= 5);
    let min_dis = sliced[0].distance_to_airline;
    let max_dis = sliced[sliced.length - 1].distance_to_airline
    log[str].push([(min_dis + max_dis) / 2 / 100,qianwu.length/sliced.length])
    // debugger
    i = max;
  }
  debugger
});
debugger
['quanti', 'gaoshou', 'dishou'].forEach(str => {
  let arr = log[str];
  arr.dev = arr.map(e => `[${e[0]},${e[1]}]`).join(",")
});
console.log(` series: [{
  data: [${log.quanti.dev}],
  type: 'line',
  smooth: true,
  name:"全体"
},{
  data: [${log.gaoshou.dev}],
  type: 'line',
  smooth: true,
  name:"高手"
},{
  data: [${log.dishou.dev}],
  type: 'line',
  smooth: true,
  name:"低手"
}]`)
debugger



return process.exit();
let logquanti = [];
let DDD = 10
let youxiaojishu = 1
for (let i = 0; i < 2500; i += DDD) {
  let min = i * 100;
  let max = (i + DDD) * 100;
  let fanweinei = DATA2.filter(e => e.distance_to_airline < max && e.distance_to_airline >= min);
  if (fanweinei.length >= youxiaojishu) {
    let qianwu = fanweinei.filter(e => e.ranking <= 1)
    // debugger
    logquanti.push([i + DDD / 2, qianwu.length / fanweinei.length])
  }
}
let loggaoshou = [];
for (let i = 0; i < 2500; i += DDD) {
  let min = i * 100;
  let max = (i + DDD) * 100;
  let fanweinei = DATA2.filter(e => e.is_gaoshou && e.distance_to_airline < max && e.distance_to_airline >= min);
  if (fanweinei.length >= youxiaojishu) {
    let qianwu = fanweinei.filter(e => e.ranking <= 1)
    // debugger
    loggaoshou.push([i + DDD / 2, qianwu.length / fanweinei.length])
  }
}
let logdishou = [];
for (let i = 0; i < 2500; i += DDD) {
  let min = i * 100;
  let max = (i + DDD) * 100;
  let fanweinei = DATA2.filter(e => !e.is_gaoshou && e.distance_to_airline < max && e.distance_to_airline >= min);
  if (fanweinei.length >= youxiaojishu) {
    let qianwu = fanweinei.filter(e => e.ranking <= 1)
    // debugger
    logdishou.push([i + DDD / 2, qianwu.length / fanweinei.length])
  }
}
[logquanti, loggaoshou, logdishou].forEach(arr => {
  arr.dev = arr.map(e => `[${e[0]},${e[1]}]`).join(",")
});
debugger
console.log(` series: [{
  data: [${logquanti.dev}],
  type: 'line',
  smooth: true,
  name:"全体"
},{
  data: [${loggaoshou.dev}],
  type: 'line',
  smooth: true,
  name:"高手"
},{
  data: [${logdishou.dev}],
  type: 'line',
  smooth: true,
  name:"低手"
}]`)
debugger
